<!-- include tpl=cart/header -->
<script type="text/javascript">
function cart_checkout()
{
	var id = $.checkbox.join();
	if(!id){
		$.dialog.alert('未指定要结算的产品');
		return false;
	}
	return true;
}
</script>
<section class="container pb-4">
	<h3 class="text-center p-4">产品列表</h3>
	<form method="post" action="{url ctrl=cart func=checkout/}" class="am-form" onsubmit="return cart_checkout()">
	<table class="table table-hover">
	<thead>
		<tr>
			<th colspan="2">图片</th>
			<th>名称</th>
			<th width="80px">数量</th>
			<th>售价</th>
		</tr>
	</thead>
	<tbody>
		<!-- loop from=$rslist key=$key value=$value id=$tmpid -->
		<tr>
			<td><input type="checkbox" name="id[]" id="id_{$value.id}" value="{$value.id}" checked onchange="$.cart.price()" /></td>
			<td>
				<!-- if $value.tid -->
				<a href="{url id=$value.tid/}" title="{$value.title}" target="_blank"><img src="{$value.thumb ? $value.thumb : 'images/nopic.png'}" width="80px" border="0" alt="{$value.title}" /></a>
				<!-- else -->
				<img src="{$value.thumb ? $value.thumb : 'images/nopic.png'}" width="80px" border="0" alt="{$value.title}" />
				<!-- /if -->
			</td>
			<td>
				<!-- if $value.tid -->
				<a href="{url id=$value.tid/}" title="{$value.title}" target="_blank"><h5 id="title_{$value.id}">{$value.title}</h5></a>
				<!-- else -->
				<h3 id="title_{$value.id}">{$value.title}</h3>
				<!-- /if -->
				<!-- loop from=$value._attrlist key=$k value=$v id=$tmpid -->
				<div>{$v.title}：{$v.content}</div>
				<!-- /loop -->
				<div>单价：{func price_format $value.price $value.currency_id}</div>
			</td>
			<td>
				<div><input type="number" class="form-control qty" min="1" name="qty_{$value.id}" id="qty_{$value.id}" value="{$value.qty}" onchange="$.cart.update('{$value.id}')" /></div>
			</td>
			<td class="text-danger">{func price_format $value.price*$value.qty $value.currency_id}</td>
		</tr>
		<!-- /loop -->
	</tbody>
	</table>
	<div class="row pt-4 pb-4 border-top">
		<div class="col text-right">当前选中的产品价格是：<span class="text-danger" id="total_price">{$price}</span></div>
	</div>
	<div class="row mb-4 border-top pt-4">
		<div class="col">
			<div class="btn-group" role="group" aria-label="">
				<button type="button" class="btn btn-primary">全选</button>
				<button type="button" class="btn btn-primary">全不选</button>
				<button type="button" class="btn btn-primary">反选</button>
			</div>
			<input type="button" value="批量删除" onclick="$.cart.del()" class="btn btn-danger" />
		</div>
		<div class="col text-right">
			<button type="submit" class="btn btn-primary btn-lg">
				去结算
				<i class="fa fa-angle-right"></i>
			</button>
		</div>
	</div>
	</form>
</section>
<!-- include tpl=cart/footer -->